<?php
/**
 * 获取购买道具列表，加倍道具，禁比道具，换牌道具等
 */
class GetPropGoodsList extends APIBase {

    public $tag = "GetPropGoodsList";
    public $isLogin = false;

    public function before() {
        $this->initCacheRedis();
        return true;
    }

    public function logic() {
        $keys = $this->cache_redis->lRange("lg:ids", 0, -1);
        $goodses = array();
        foreach ($keys as $key) {
            $goods = $this->cache_redis->hMGet("hg:{$key}", array("id","type", "rmb", "buy_money","buy_coin","propid","propnum"));
            $goods["type"] = (int)$goods["type"];
            if ($goods["type"] == 2) { //商城商品标识 type=1, 商城不显示的特殊商品 type=2, 道具场使用的道具商品 type=3
                $prop_good["id"] = (int)$goods["id"];
                $prop_good["rmb"] = (float)$goods["rmb"];
				$prop_good["buy_money"] = (float)$goods["buy_money"];
				$prop_good["buy_coin"] = (float)$goods["buy_coin"];
                $prop_good["propid"] = (string) $goods["propid"];
                $prop_good["propnum"] = (string) $goods["propnum"];
               
                $goodses[] = $prop_good;
            }
        }
		
        $this->returnData(array('prop_goods' => $goodses));
    }

    public function after() {
        $this->deinitCacheRedis();
    }
}
?>
